cmake_minimum_required(VERSION 3.15)

project(UserInterface)

# QT env configuration
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt5 COMPONENTS 
    Core 
    Widgets
    Network
    SerialPort
    Multimedia
    MultimediaWidgets
    REQUIRED
)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS 
    Core 
    Widgets
    Network
    SerialPort
    Multimedia
    MultimediaWidgets
    REQUIRED
)
add_library(UserInterface STATIC
    src/qbcitargetinterface.cpp
    include/qbcitargetinterface.h
    include/QBciTargetInterface
    src/qbcitarget.cpp
    include/qbcitarget.h
    include/QBciTarget
    src/qbcitargetsgroup.cpp
    include/qbcitargetsgroup.h
    include/QBciTargetsGroup
    src/qbciglinterface.cpp
    include/qbciglinterface.h
    include/QBciGLInterface
    src/qbcirender.cpp
    include/qbcirender.h
    include/QBciRender
    src/qbcishape.cpp
    include/qbcishape.h
    include/QBciShape
    src/qbciopacityrender.cpp
    include/qbciopacityrender.h
    include/QBciOpacityRender
    src/qbciscreencontroller.cpp
    include/qbciscreencontroller.h
    include/QBciScreenController
    src/qbciscreencontrollershell.cpp
    include/qbciscreencontrollerShell.h
    include/QBciScreenControllerShell
    src/qbciscreencontroller.cpp
    include/qbciscreencontroller.h
    include/QBciScreenController
    src/qbciserial.cpp
    include/qbciserial.h
    include/QBciSerial
)
add_library(utils::UserInterface ALIAS UserInterface)

target_include_directories(UserInterface
    PUBLIC
    ${PROJECT_SOURCE_DIR}/include
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Widgets
    utils::QLogger
)
target_link_libraries(UserInterface
    PUBLIC
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::Network
    Qt${QT_VERSION_MAJOR}::SerialPort
    Qt${QT_VERSION_MAJOR}::Multimedia
    Qt${QT_VERSION_MAJOR}::MultimediaWidgets
    utils::QLogger
)

add_subdirectory(demo/GLInterfaceDemo)
